<%@page import="java.awt.Desktop.Action"%>
<%@page import="net.zdsoft.keel.util.DateUtils"%>
<%@page import="net.zdsoft.wpchat.android.util.DateUtil"%>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="net.zdsoft.wpchat.android.client.Constant"%>
<%@ page import="net.zdsoft.wpchat.support.enums.NewsTypeEnum" %>
<%@ page import="net.zdsoft.wpchat.support.action.NewsAction" %>
<%@ page import="net.zdsoft.wpchat.support.util.PageUtils" %>
<%@ page import="net.zdsoft.wpchat.support.entity.dto.InfoNewsDto" %>
<%@ page import="net.zdsoft.wpchat.support.entity.InfoHomePage" %>
<%@ page import="net.zdsoft.wpchat.support.entity.Operator" %>
<%@ page import="java.util.List" %>
<%
NewsAction action = (NewsAction)PageUtils.getAction();
NewsTypeEnum newsTypeEnum = action.getNewsTypeEnum();
int type = action.getType();
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/script/prototype.js"></script>
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/script/buffalo.js"></script>
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/script/replyutils_s.js"></script>
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/script/information/utils.js"></script>
<script charset="utf-8" src="<%=request.getContextPath()%>/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<%=request.getContextPath()%>/kindeditor/kindeditor-jxhlext.js"></script>
<script language="javascript">
function InfoNewsDto(title,type,content,expiredTimeStr){
  this.title = title;
  this.type = type;
  this.content = content;
  this.expiredTime = expiredTimeStr;
}
function onSubmitForm(){
  addSubmitForm();
}

function addSubmitForm(){
  var title = $("title").value;
  var type = parseInt($("type").value);
  var content = $("news_Id").value;
  var expiredTimeStr = $("expiredTimeStr").value;
  var dto = new InfoNewsDto(title,type,content,expiredTimeStr);
  buffalo.remoteCall("remoteNews.htm", "addModifyNews", [dto,false], function(reply) {
    if(!hasActionErrors(reply)){
      document.newsForm.reset();
     }
     window.scroll(0,0);
     drawMessages(reply);
     });
}
</script>
</head>
<body>
<div id="tableMain">
<div id="message"></div>
    <form name="newsForm"  method="get" action="javascript:onSubmitForm()">
      <table id="dataTable" border="0" align="center" cellpadding="5" cellspacing="1">
        <tr>
            <td width="20%" class="titleTd">标题</td>
            <td><input id="title" name="title" size="40"/><font color="red">*</font></td>
        </tr>
        <tr>
            <td width="20%" class="titleTd">公告级别</td>
            <td>
              <select id="type" name="type" <%=type==1?"":"disabled='disabled'" %> >
                <%
                for(NewsTypeEnum newsType:NewsTypeEnum.values()){
                if(type==1){
                    %>
                    <option value="<%=newsType.getValue()%>"><%=newsType.getDescription()%></option>
                    <%
                }else{
                    %>
                    <option value="<%=newsTypeEnum.getValue()%>"><%=newsTypeEnum.getDescription()%></option>
                    <%
                }
                }
                %>
              </select>
            <font color="red">*</font></td>
        </tr>
        <tr>
          <td width="20%" class="titleTd">过期时间：</td>
          <td width="80%">
          <input name="expiredTimeStr"  id="expiredTimeStr" type="text" size="10" maxlength="10" value="" />
          <a href="javascript:void(0)" onclick="gfPop.fPopCalendar(document.newsForm.expiredTimeStr);return false;" hidefocus="hidefocus">
            <img name="popcal" align="absmiddle" src="../../calendar/calbtn.gif" width="34" height="22" border="0" alt="开始时间" /></a>
          &nbsp;<span class="red">*</span></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="300" align="left" bgcolor="#FFFFFF" style="padding-right:5px;" colspan="2">
            <table height="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="100%" height="100%">
                  <textarea id="news_Id" name="content" style="width:700px;height:400px;display:none;">
                  </textarea>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <div id="buttonRight">
          <input type="submit" class="colorButton" value="确定"/>
      </div>
      </form>
</div>
<iframe width="174" height="172" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="../../calendar/ipopeng.html?begin=<%=DateUtils.currentDate2StringByDay()%>" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; left:-500px; top:0px;">
</iframe>
<script language="javascript" type="text/javascript">
KE.show({
  id : 'news_Id',
  imageUploadJson : "<%=request.getContextPath()%>/support/information/topicNewsUpload.htm",
  flashUploadJson : "<%=request.getContextPath()%>/support/information/topicNewsUpload.htm?fileType=1",
  mediaUploadJson : "<%=request.getContextPath()%>/support/information/topicNewsUpload.htm?fileType=2"
});
</script> 
</body>
</html>